package top.soulblack.purchasesale.service;

import org.springframework.stereotype.Service;
import top.soulblack.purchasesale.mapper.GoodsStyleMapper;
import top.soulblack.purchasesale.model.GoodsSize;
import top.soulblack.purchasesale.model.GoodsStyle;

import javax.annotation.Resource;
import java.util.List;

/**
 * create by 小川
 */

@Service
public class GoodsStyleService {


    @Resource
    private GoodsStyleMapper goodsStyleMapper;

    public List<GoodsStyle> selectAll(){
        return goodsStyleMapper.selectAll();
    }

    public List<String> selectclassif(){
        return goodsStyleMapper.selectclassif();
    }

    public void addStyle(GoodsStyle goodsStyle) {
        goodsStyleMapper.addStyle(goodsStyle);
        return;
    }

    public boolean existStyle(String name) {
        int num  = goodsStyleMapper.existStyle(name);
        if (num == 1) {
            return true;
        }
        return false;

}
    public List<GoodsStyle> selectForClassify(Integer classify) {
        return goodsStyleMapper.selectForClassify(classify);
    }

    public boolean deleteStyle(Integer styleId) {
        List<Integer> num = goodsStyleMapper.deleteById(styleId);
        if (num != null) {
            return true;
        }
        return false;
    }

    public boolean updateStyle(GoodsStyle goodsStyle) {
        int num = goodsStyleMapper.updateByPrimaryKey(goodsStyle);
        if (num == 1) {
            return true;
        }
        return false;
    }

    public boolean selectStyle(Integer styleId){
        List<Integer> num = goodsStyleMapper.selectStyle(styleId);
        if (num  != null) {
            return true;
        }
        return false;
    }
}
